-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add no-pic debug flag to disable position independent code #11995
Conversation
Can you add this as a regular flag, rather than a debug one? The documentation needs to be updated too. Does it make sense to also expose |
I'm not sure what the use cases are. I just ran out of ways to build Cortex-M code in a sane way (gets hard quickly with rlibs) so I've started implementing all the small things that looked like they had consensus but were closed for other reasons. I'll look at moving it into a normal flag and documenting it. |
I'm a little uneasy about this in either |
@alexcrichton: |
It's true, but One thing I also forgot to mention is how crates link together. If I disable relocatable code, can I generate a dynamic library? Also, if one rlib has no relocatable code, and mine does, can I link to it? In general I think we want to give errors before running the linker. I'm unsure of how all these modes play together, so I'm fine with merging and seeing how this all plays out. |
I think what you're allowed to do will depend heavily on the platform and the native libraries you're linking against. I don't think it's worth trying to add sensible errors at a Rust frontend level because it's only used in rare edge cases. |
I'd be down with that. @bharrisau, taking a leaf out of LLVM's book, I think that this should probably add a |
+1, lets copy |
We now have |
Closing due to inactivity, but I'd love to see this implemented! |
…eykril Generate enum variant assist So, this is kind of a weird PR! I'm a complete newcomer to the `rust-analyzer` codebase, and so I browsed the "good first issue" tag, and found rust-lang#11635. Then I found two separate folks had taken stabs at it, most recently `@maartenflippo` — and there had been a review 3 days ago, but no activity in a little while, and the PR needed to be rebased since the crates were renamed from `snake_case` to `kebab-case`. So to get acquainted with the codebase I typed this PR by hand, looking at the diff in rust-lang#11995, and I also added a doc-test (that passes). I haven't taken into account the comments `@Veykril` left in rust-lang#11995, but I don't want to steal any of `@maartenflippo's` thunder! Closing this PR is perfectly fine. Or Maarten could use it as a "restart point"? Or I could finish it up, whichever feels best to everyone. I think what remains to be done in this PR, at least, is: * [x] Only disable the "generate function" assist if the name is `PascalCase` * [x] Only enable the "generate variant" assistant if the name is `PascalCase` * [x] Simplify with `adt.source()` as mentioned here: rust-lang/rust-analyzer#11995 (comment) * [ ] Add more tests for edge cases? Are there cases where simply adding one more indent level than the enum's indent level is not good enough? Some nested trickery I'm not thinking of right now? Anyway. This PR can go in any direction. You can tell me "no, tackle your own issue!" And I'll go do that and still be happy I got to take a look at rust-analyzer some by doing this. Or you can tell me "okay, now _you_ finish it", and I guess I'll try and finish it :) Closes rust-lang#11635
Probably don't want to be adding to the number of debug flags, but there seemed to be interest in adding this in #10942.
From the LLVM source DynamicNoPIC is "Relocatable external references, non-relocatable code". On platforms it isn't supported on it becomes either RelocStatic or RelocPIC.
Again, I haven't written a test. I couldn't see any existing ones for PIC stuff. Passes existing tests though.